package com.gao.utils;

import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;

public class JdbcUtil {
	private static Properties pps = new Properties();
	private static InputStream in = JdbcUtil.class.getResourceAsStream("/db.properties");
	
	
	public static Connection getConnection() {
		try {
			pps.load(in);
			String url = pps.getProperty("url");
			String user = pps.getProperty("user");
			String password = pps.getProperty("password");
			String driverClass = pps.getProperty("driverClass");
			Class.forName(driverClass);
			return DriverManager.getConnection(url, user, password);
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			throw new RuntimeException(e);
		}
		
	}

}
